package edu.zut.array;

public class Demo5 {

    public static void main(String[] args) {
        show2();
    }

    /**
     * foreach增强循环
     * 嵌套
     */
    public static void show2() {
        String[][] bigdataNames2 = {{"jack", "tom", "rose", "lucy"},
                {"张三", "李四", "王五", "赵六"},
                {"花花", "美美", "丽丽", "天天", "豆豆"}};
        for (String[] arr : bigdataNames2) {
            for (String s : arr) {
                System.out.println("s = " + s);
            }
        }
    }

    /**
     * 获取二维数组中的所有元素
     * for  嵌套循环
     */
    public static void show() {
        String[][] bigdataNames2 = {{"jack", "tom", "rose", "lucy"},
                {"张三", "李四", "王五", "赵六"},
                {"花花", "美美", "丽丽", "天天", "豆豆"}};

        for (int i = 0; i < bigdataNames2.length; i++) {
//            bigdataNames2[i]
            for (int j = 0; j < bigdataNames2[i].length; j++) {
                System.out.println(bigdataNames2[i][j]);
            }
        }
    }


}
